<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<form id="role-form">
			<div class="select-list">
				<ul>
					<li>
						项目Id：<input type="text" name="projectId" th:value="${projectInfo.projectId}" readonly="readonly"/>
					</li>
					<li>
						项目名称：<input type="text" name="projectName" th:value="${projectInfo.projectName}" readonly="readonly"/>
					</li>
					<li>
						<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
					</li>
				</ul>
			</div>
		</form>

		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="toAddHtml()" shiro:hasPermission="pm:projectBudget:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="pm:projectBudget:edit">
	            <i class="fa fa-edit"></i> 修改
	        </a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="pm:projectBudget:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('pm:projectBudget:edit')}]];
        var removeFlag = [[${@permission.hasPermi('pm:projectBudget:remove')}]];
        var prefix = ctx + "pm/projectBudget";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add/{id}",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "项目预算",
				queryParams: queryParams,
				search: false,
				showSearch: false,
				showColumns: false,
				showToggle: false,
				showExport: false,
				showRefresh: false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : 'id' 
				},
				{
					field : 'projectId', 
					title : '项目Id' 
				},
				{
					field : 'staffType', 
					title : '人员类别' 
				},
				{
					field : 'staffLevel', 
					title : '人员资质' 
				},
				{
					field : 'workload', 
					title : '工作量（人月）' 
				},
		        ]
            };
            $.table.init(options);
        });

		function queryParams(params) {
			return {
				projectId:      $("input[name='projectId']").val(),
				pageSize:       params.limit,
				pageNum:        params.offset/params.limit + 1,
				searchValue:    params.search,
				orderByColumn:  params.sort,
				isAsc:          params.order
			};
		}

		function toAddHtml(){
			$.operate.add($("input[name='projectId']").val());
		}
    </script>
</body>
</html>